package com.myfoon.model.entity;

import java.io.Serializable;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "VIDEO")
public class Video implements Serializable {
    private Long id;
    private User owner;
    private String src;
    private String srcframe;
    private Short length;
    private Timestamp created;
    private String tempId;

    public Video() {
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Id 
    @GeneratedValue(generator = "VideoSequence", strategy = GenerationType.AUTO)
    @SequenceGenerator(name = "VideoSequence", allocationSize = 1, sequenceName = "VIDEO_SEQ_01")
    @Column(name = "ID", unique = true, nullable = false)
    public Long getId() {
        return id;
    }

    public void setOwner(User owner) {
        this.owner = owner;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "OWNER")
    public User getOwner() {
        return owner;
    }

    public void setSrc(String src) {
        this.src = src;
    }

    @Column(name = "SRC")
    public String getSrc() {
        return src;
    }

    public void setSrcframe(String srcframe) {
        this.srcframe = srcframe;
    }

    @Column(name = "SRC_FRAME")
    public String getSrcframe() {
        return srcframe;
    }

    public void setLength(Short length) {
        this.length = length;
    }

    @Column(name = "LENGTH")
    public Short getLength() {
        return length;
    }

    public void setCreated(Timestamp created) {
        this.created = created;
    }

    @Column(name = "CREATED")
    public Timestamp getCreated() {
        return created;
    }

    public void setTempId(String tempId) {
        this.tempId = tempId;
    }
    
    @Transient
    public String getTempId() {
        return tempId;
    }
}
